package com.lx.oms.controller.manager.impl;

import java.math.BigInteger;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.lx.oms.common.utils.Utils;
import com.lx.oms.controller.dao.WOrderCategoryMapper;
import com.lx.oms.controller.entity.WOrderCategoryEntity;
import com.lx.oms.controller.manager.WOrderCategoryManager;

/**
 * 微信下单多个分类重量
 *
 * @author houzhong
 * @date 2018年8月08日 上午10:44:31
 */
@Component("wOrderCategoryManager")
public class WOrderCategoryManagerImpl implements WOrderCategoryManager {

	@Autowired
	private WOrderCategoryMapper wOrderCategoryMapper;
	

	@Override
	public List<WOrderCategoryEntity> listWOrderCategory(WOrderCategoryEntity categoryEntity) {
		return wOrderCategoryMapper.listWOrderCategory(categoryEntity);
	}

	@Override
	public int saveWOrderCategory(WOrderCategoryEntity wOrderCategory) {
		if (wOrderCategory.getId() == null) {
			wOrderCategory.setId(Utils.id().toString());
		}
		return wOrderCategoryMapper.save(wOrderCategory);
	}

	@Override
	public WOrderCategoryEntity getWOrderCategoryById(BigInteger id) {
		WOrderCategoryEntity wOrderCategory = wOrderCategoryMapper.getObjectById(id);
		return wOrderCategory;
	}

	@Override
	public int updateWOrderCategory(WOrderCategoryEntity wOrderCategory) {
		return wOrderCategoryMapper.update(wOrderCategory);
	}

	@Override
	public int batchRemove(String[] id) {
		int count = wOrderCategoryMapper.batchRemove(id);
		return count;
	}
	
}
